home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
A-B
/
Alpha.5.05.cpt
/
Help
/
Alpha Help
next >
Wrap
Text File
|
1992-09-06
|
54KB
|
1,400 lines
==============================================================================
= Copyright © 1990, 1991, 1992 Pete Keleher. All Rights Reserved.
==============================================================================
The Author(s) of this product are in no way liable for any direct or
indirect damage caused by the product.
You may freely copy and distribute ALPHA, but please bear in mind that
ALPHA is Shareware. If you decide to keep it, please register your copy by
sending $25 to the author. Site licences are $110. Source licenses are also
available, inquire with the author. If you include an internet (or
Compuserve) address with your registration, I will notify you when new
versions become available. Please make any check or money order out to Pete
Keleher, NOT to Rice University.
E-mail address: pete@rice.edu
Snail-mail address: Pete Keleher
P.O. Box 1892
Dept. of Computer Science
Rice University
Houston, TX 77251-1892
I would like to start collecting user-written Tcl procs and XTCLs in
public/Alpha/contrib on cs.rice.edu. If you have written anything that
you think may be of general interest, please send it to me and I will
make it available.
Thanks to Masatsugu Nagata, Karl J. Smith and Jerry Fowler.
WHAT TO DO:
Alpha is a very powerful, multi-purpose editor that allows any program-
or user-defined function to be bound to any keystroke, or placed into
user-defined menus. Only the "File", "Edit", and "Search" menus are
predefined and immutable. The rest are defined in the startup file
("AlphaBits.tcl") or files sourced from inside it.
The supported macro language is Dr. Ousterhout's Tool Command Language, Tcl
for short. See the "Help" menu for a complete definition of the language.
Alpha uses a port of Tcl done by Tim Endres for his "Tickle" application.
Therefore, Alpha supports many of the same extension as Tickle. Many of the
functions bound to keystrokes, as well as many of the functions in the
user-defined menus, are written in Tcl.
Callable functions in Alpha come in three different flavors. First, there
are the directly-accessed Alpha functions; these are discussed in the
section entitled "Unparamed Cmds" below. These functions take no arguments.
Second, there are the Tcl-callable functions. These functions in general
take arguments, and are discussed in the "Alpha Extensions" help file
(look in the "Help" menu).
Finally, there are the Tcl functions defined with "proc". Most of Alpha's
predefined functions are in "procs.tcl", some are in "shell.tcl".
The only way to get to know the editor and the language is to try different
things out. Play around. Choose "Misc:List Bindings" to get a listing of
all the current keystoke bindings. Look in "procs.tcl" for definitions of
the routines. Look in "AlphaBits.tcl" for definitions of the last five
menus. And finally, please feel free to send suggestions/"feature"
reports/questions to me at pete@cs.rice.edu. I am not able to answer US
postal mail, but if you send it to me I will at least read it. Have fun!
Finally, memory usage and startup speed. Alpha uses a lot of memory, and it
takes a while to start up. One important reason for this is that the
default setup executes a large amount of Tcl code. Much of this you
probably won't need. "procs.tcl" has over 1000 lines of code it it. Much of
this you probably won't use every day, and can be cut out. "procs.tcl"
includes the file "latex.tcl", which has 600 more lines of tcl. If you
don't use these functions, change the following line in "procs.tcl":
set usingLatex 1
to
set usingLatex 0
The next you start up Alpha the Latex functions won't be loaded.
Additionally, "globbing" while creating file sets can take a significant
amount of time (look at the beginning of "procs.tcl").
==============================================================================
= Reading and Storing Files
==============================================================================
The primary method of either reading or storing files with Alpha, or any
other Mac editor, is through the GetFile and PutFile dialogs. However,
Alpha's dialogs are not exactly like those of other applications.
The GetFile dialog has two additional items: a "Readonly" checkbox and an
"All Files" checkbox. The first allows you to open a file as read only.
Files in the readonly state can not be modified, only read. A writable file
is indicated by a pen icon to the left of the horizontal scrollbar. A
readonly file is indicated by a pen with a line through it. If you change
your mind about the file, it's readonly status can be changed by clicking
on the pen icon.
The second checkbox, "All Files", allows Alpha to open any file rather
than just those of type 'TEXT'. The type of a file can be determined by
using the 'll' alias in the Tcl shell.
The PutFile dialog is used to prompt the user for a new name under which to
save the contents of a window. This dialog has been enhanced by two popup
menus: "State" and "Format". "State" allows you to specify how much
information should be saved in the resource fork of files that you use. If
the state is set to "MPW", window position, current selection, tab sizes,
and font information are saved into the resource fork of your application
every time you open and close it, *even if you don't modify the file*.
Alpha still manages to coexist with build or make files because saving this
information does not change the modification date of the file. If the state
is set to "Think", neither the window position nor the current selection
are saved. If state is set to "None", no information is saved. The default
value for saved state can by changed by setting the Alpha variable
'savedState' to "mpw", "think", or "none". Note that if a given file
already has mpw information in it when the file is open, Alpha will always
update that information when the file is closed. Note also that "marks"
are always saved in the resource fork whenever a file is saved,
regardless of the setting of the 'savedState' variable.
The "Format" menus allows the way Alpha terminates lines to be changed.
The Mac uses a carriage return to mark the end of a line, Unix uses a
linefeed, and IBM uses both (of course). Alpha can read and write any of
these formats, and can convert between them just by opening a file,
choosing "Save As", and changing the selection in this menu. Note that if
you are going to be sharing files with a Unix or IBM machine, you
probably don't want anything in your resource fork, so you'd probably
want to set 'savedState' to 'none' in your AlphaBits.tcl file.
==============================================================================
= Marks
==============================================================================
Alpha allows the user to use "marks" to remember positions in files. Marks
"float". That is, if a mark is initially at position 312 and then five
characters are inserted at location 297, the mark's new value will be 317.
Alpha uses three different types of marks.
The first is generically referred to as "the mark". The mark is set to the
current insertion point by the command 'setMark' (command-space by
default). The position in the file indicated by the blinking cursor is
referred to as the current insertion point. Many commands (such as "cut"
and "copy") can operate either on the currently selected (hilighted) text,
or the text between the current insertion point and "the mark". For
example, if you move the cursor to the beginning of the work "allybaba",
hit command-space (the status bar should say "Mark set"), move to the end
of the word and hit option-w (the status bar should say "Region copied"),
the effect is the same as if you had used the mouse to select the text and
then selected the "Copy" command from the "Edit" menu.
The second type of mark are the permanent marks. Permanent marks are set,
removed, and moved-to through the three corresponding menu items in the
"Search" menu. Permanent marks differ from the generic mark in that they
have names, there can be any number of them, and they are saved in the
resource fork if the file is subsequently saved.
The third type of mark is the temporary mark. Like permanent marks,
temporary marks can be named and there can be any number of them. Unlike
permanent marks, temporary marks do not "dirty" the file, and they aren't
saved. So far, temporary marks are used exclusively to implement higher
order functions in TCL procedures. In the 5.0 release, temporary marks are
used to implement a "mark stack" and a for loop template.
==============================================================================
= The Mark Stack
==============================================================================
The mark stack is a last-in-first-out (LIFO) stack of temporary marks
managed by the TCL procedures 'pushMark' and 'popMark'. 'pushMark' creates
a new temporary mark of the current insertion point and adds it on to the
top of the stack. 'popMark' removes the top mark from the stack and goes
toit. A typical use of the mark stack is a 'pushMark' at the current
position, go look somewhere else in the file, and then 'popMark' to get
back to where you were. However, the stack is recursive, so there can be
any number of 'pushMarks' before the marks start to be popped back off the
stack.
==============================================================================
= Templates
==============================================================================
Temporary marks can also be used to with language construct templates. The
file "template.tcl" contains an example implementing a template for C's
'for' command. Depressing control-i will insert a template for the "for"
command into the current window. Five temporary marks are defined in the
for structure, three inside the parenthesis, one where the "for" body text
will be inserted, and one after outside the for body entirely. Depressing
control-shift-i moves the cursor to the next of the five temporary marks
allowing quick entry of the entire command.
==============================================================================
= The Tool Command Language (TCL)
==============================================================================
See the TCL manual page for a complete description of TCL and it's
commands. The menu item "Misc:Tcl Man" opens this file in the default menu
configuration. Each of the Tcl commands and several sections have a mark
defined, so you can use the "Mark" titlebar menu to navigate through the
manual page.
Alpha extends the TCL command set to allow access to Alpha variables,
menus, and commands. The new commands are divided into those that take
parameters or return values, and those that do neither. The former are
called 'parameterized functions'. The following is a list of the
parameterized Alpha commands, together with their syntax:
==============================================================================
= Alpha's Basic Commands
==============================================================================
The following functions are called without any arguments, and as such can
be directly bound to keystrokes or put in menus. Menu "Help:Alpha Extensions"
lists a second type of Alpha function that must be called from tcl. A
final type of Alpha functions are Tcl procedures, which are explained in
"Help:Tcl Manual".
• abortEm - aborts whatever is currently happening
• alphaHelp - display Alpha help.
• backColor - set background color
• backwardCharSelect - extends selection one char back
• backwardChar - moves insertion one char back
• backwardDeleteWord - deletes previous word
• backwardWord - moves insertion one char back
• balance - selects smallest set of parens, braces, or
brackets that encloses the current selection
• beginningBufferSelect - extend selection to the
beginning of the buffer
• beginningLineSelect - extend selection to the
beginning of the line
• beginningOfBuffer - move insertion to the beginning
of the buffer
• beginningOfLine - move insertion to the beginning of
the line
• capitalizeRegion - capitalize all words in selected
region
• capitalizeWord - capitalize word
• centerRedraw - redraw window with current line in
the middle.
• clear - clear selected text
• closeAll - close all windows
• copy - copy region
• createTagFile - searches all files in current file set
and saves the locations of any function declarations
in a file called 'cTAGS'.
• currentPosition - displays current and total bytes.
• cut - deletes and saves region
• deleteChar - delete char AFTER cursor
• deleteSelection - delete current position, don't save
• deleteWord - delete word after cursor
• downcaseRegion - changes all uppercase letters to
lowercase in current region
• downcaseWord - changes all uppercase letters to
lowercase in current word
• dumpColors - dump current foreground and background
colors into the current buffer in Alpha-readable
format.
• endBufferSelect - extend selection to the end of the
buffer
• endKeyboardMacro - stop recording keyboard macro
• endLineSelect - extend selection to the end of line
• endOfBuffer - move insertion to the end of the buffer
• endOfLine - move insertion to the end of the line
• exchangePointAndmark - exchange the current 'mark'
w/ the current insertion point
• execute - prompt user for a function or macro. The
space and tab keys act as "completion" commands.
• executeKeyboardMacro - execute the current keyboard
macro
• fileInfo - prompts for a file, and displays type,
creator, sizes of both data and resource forks, last
modification time, and creation time
• fileRemove - prompts for a file, and removes it
• findTag - prompt user for a function name and attempt
to use the file 'cTAGS' to locate the function's
definition
• find - bring up the find dialog
• findFile - open a file in a new window
• foreColor - set foreground (text) color
• forwardCharSelect - extend selection one character
forward
• forwardChar - move insertion one character forward
• forwardWord - move insertion one word forward
• freeMem - give a rough approximation of the current
memory reserves of ALPHA
• getAscii - displays the ASCII code for character at
current insertion point
• getPathName - present the user w/ a SFGetFIle dialog
and paste the complete path-name of the chosen file
into the current window
• gotoLine - go to a line number
• gotoMark - goto named mark, use 'mark' in macros.
• includeFile - expand the current selection to include
the suffix and use the var 'includePath' to try to
find the include file.
• indentLine - semi-intelligent indent. If cursor is
before first non-white space of line, the line is
indented and the selection is placed at the start
of the non-white space text
• insertAscii - prompts for an ASCII code and inserts
into text.
• insertFile - prompts for a file name and inserts the
corresponding file into the current window. Not
undoable.
• insertToTop - make the line that the insertion point
is on the first line shown, and display the current
line number along w/ the total number of lines in file
• isearch - incremental search: searches w/o a dialog,
searches as you type the search pattern. Does not do
regular expression searches. 'matchWords'
automatically set to false.
• iterationCount - allows actions to be repeated many
times. "option-u 44 =" inserts 44 '='s into current
window. Also can be used to execute any function or
macro (including the keyboard macro) many times.
• keyAscii - insert ascii representation (in decimal)
of the keydown event, plus a modifier string, if
necessary.
• keyCode - insert the key code along w/ a string
representing and modifiers into the current window.
Can be used to create bindings in 'Alphabits'.
• killLine - kill text from insertion point to the end
of the line. If the line has no text, delete the line
and move succeeding lines up one.
• killWindow - kill current window
• listBindings - list all current bindings.
• load - loads hilited text, or entire window if
nothing is hilited. 'load'ing means that whatever
bindings or macro definitions are present in the
loaded text take effect
• markHilite - This is the 'Hilite' from the 'Edit'
menu. If there is a currently hilited selection, the
selection is unhilited, leaving the mark and the
insertion point around the old selection. If there
is not a selection, the region between the insertion
point and the mark is selected.
• matchBrace - moves the insertion point to the
character that matches the character after the current
insertion point
• moveInsertionHere - move the insertion point to the
first line displayed
• new - opens an untitled window
• nextLineSelect - extend selection to the next line
• nextLine - move insertion point to next line
• nextWindow - select next window
• oneSpace - converts whitespace surrounding insertion
into a single space.
• openLine - insert a new line following the current
one and move the insertion point to it
• pageBack - display prev screenful, move the
insertion point if 'moveInsertion' enabled
• pageForward - display next screenful, move the
insertion point if 'moveInsertion' enabled
• pageSetup - display the printing PageSetup dialog.
• paste - insert the last chunk of text created by 'cut'
or 'copy'
• prefixChar - used to further modify the next keystroke
combination, in the same manner as using the shift key
in the next keystroke
• prevLineSelect - extend selection to the previous line
• prevWindow - select previous window
• previousLine - move insertion point to the previous
line
• print - print front window
• quit - quits ALPHA
• rectMarkHilite - creates a rectangular selection
between the mark and the insertion point.
• redo - redo the next action that has been undone but
not redone
• removeMark - allows marks to be removed.
• repeatSearchBackward - repeat search backward
• repeatSearchForward - repeat search forward
• restoreVars - restore variables to saved state,
see 'saveVars'
• revert - revert the file to it's last saved version
• rsearch - reverse incremental search, see 'isearch'.
• save - save current window
• saveAs - save current window with new name
• saveVars - save variable state, see 'restoreVars'
• scrollDownLine - same action as that which occurs when
the down arrow in the vertical scrollbar is selected
• scrollLeftCol - same action as that which occurs when
the left arrow in the horizontal scrollbar is selected
• scrollRightCol - same action as that which occurs when
the right arrow in the horizontal scrollbar is
selected
• scrollUpLine - same action as that which occurs when
the up arrow in the vertical scrollbar is selected
• searchEnter - use current selection for future
searches
• searchNext - search next file.
• searchRall - replace all further occurrences in the
current file
• searchReplace - replace the current selection
• searchRfa - replace the current selection and find
next occurrence
• setMark - set the current mark to the insertion point
• setFontsTabs - bring up font and tab dialog
• setNamedMark - set named mark
• shell - open the Tcl shell.
• shiftRegionLeft - shifts the current region left a tab
• shiftRegionRight - shift the current region right a
tab
• sortMarks - sorts all marks of open windows, w/o
setting the dirty flag. If the files are saved, the
marks will be saved in alphabetical order.
• spacesToTabs - convert spaces in selection to tabs
• startEscape - used to further modify the next
keystroke combination, in the same manner as using the
shift key in the next keystroke
• startKeyboardMacro - start recording keyboard macro
• tab - insert a tab
• tabsToSpaces - convert tabs in selection to spaces.
• tclFileCompletion - completes the previous word as a
file is in a shell window
• undo - undo the last action that has not been undone
• upcaseRegion - convert all lowercase letters to
uppercase in the current region
• upcaseWord - convert all lowercase letters to
uppercase in the current word
• wrap - see the section on "Fill" routines.
• yank - insert the last piece of deleted text of less
than 1k. Consecutive deletes are concatenated.
together.
• zapInvisibles - removes chars < ascii 32, except for
LF's and CR's.
• zoom - zooms the current window
==============================================================================
= Key Bindings
==============================================================================
Any TCL command can be bound to any single keystroke. One way to bind a
function is with a statement such as:
bind 'c' <modifier string> funcName [<mode>]
where c is a character, <modifier string> is an optional string containing
one or more of:
c - command modifier
o - option modifier
s - shift modifier
z - control modifier
e - escape modifier
Additionally, the modifier string can contain a capital letter specifying
that the binding is only activated if preceded by control and the lowercase
version of that letter. This feature allows multiple-key combinations ala
Emacs. The following line binds cmd-shift-f to the function 'forwardChar':
bind 'f' <cs> forwardChar
The next line would bind the same function to C-x C-f:
bind 'f' <cX> forwardChar
'mode' is an optional parameter that specifies, when present, that the
binding is only active in a given mode, where the current mode is the
parameter to the last call of 'displayMode' (look in "procs.tcl"). Note
that given a general binding (no mode specification) and a binding specific
to the current mode, the last binding to have been created is the one found
first.
Additionally, most keyboards have keypads and/or Function Keys. These
keys can be bound using case-insensitive numeric labels using the same
bind command as above, with the label replacing the character. For
example, to bind F1 to function 'funcName', the following would work:
bind F1 funcName
As above, the binding can include a modifier string. The following labels
are defined for US keyboards:
Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 Help Home Pgup Del
End Pgdn Left Left Right Right Up Up Down Down Clear Kpad Kpad Kpad Kpad7
Kpad8 Kpad9 Kpad Kpad4 Kpad5 Kpad6 Kpad Kpad1 Kpad2 Kpad3 Kpad0 Kpad Enter
The function 'listBindings' will list all of the bindings currently in
effect in a format suitable for re-loading.
The above labels may not be sufficient for all keyboards (attention
international users). If a hex number is used instead of a character inside
the single quotes, the binding is done to key codes instead of ascii
values. The following is a key code version of the same binding:
bind '\0x03' <cs> forwardChar
The key code for any given key can be obtained by using the 'keyCode'
function. Note that menu item command equivalents take precedence over
bindings, and that the 'bind' command does not affect the command
equivalents displayed in the menus. Command equivalents can only be changed
by using an external tool like 'ResEdit'. Also note that key code bindings
take precedence over ascii bindings.
==============================================================================
= User-Defined Menus
==============================================================================
Alpha allows the the user to build custom menus which contain names of
functions, macros, or arbitary TCL commands that just HAVE to be in the
menus, as opposed to being merely callable through the bindings. The
syntax is dead simple. Menus can be nested, allowing heirachical menus to
be defined. See the 'AlphaBits.tcl' file for examples (only the first
three Alpha menus are hard-coded into the Application, the others are set
up through the AlphaBits file). The following meta characters can be
embedded in the strings:
Meta-character Usage
-------------- -----
; or Return Separates multiple items.
^ Followed by an icon number, adds
that icon to the item.
! Followed by a character, marks the
item with that character.
< Followed by B, I, U, O, or S, sets
the character style of the item.
/ Followed by a character, sets up
a keyboard equivalent.
( Disables the item.
The menu creation syntax is :
menu <name> "Tcl list of items"
Once the menus are created, they can be inserted and deleted from the
menu bar by the syntax:
insertMenu "name"
deleteMenu "name"
as well as through macros.
The following strings have the obvious special meanings when used as menu
item text:
FLAGMENU
VARMENU
FSETMENU
WINDOWMENU
The 'WINDOWMENU' (the menu that allows selection of windows) cannot be
redefined after startup and can only be used in one menu.
Alpha attempts to make procedure names readable in the menus by separating
words at any capitalized letter. For example, 'findFile' becomes "Find
File".
Menu items can be enabled and disabled through the TCL command
'hiliteMenuItem'.
==============================================================================
= Suffix Hooks
==============================================================================
Alpha executes the TCL commands "openHook", "closeHook", "activateHook",
"suspendHook", and "resumeHook" when the corresponding events occur.
Default implementations for these commands are in the file 'proc.tcl'.
These commands can be modified to perform arbitrary commands, including
saving of files, implementation of per-window variables, etc.
==============================================================================
= Searching
==============================================================================
ALPHA has a full repertoire of searching commands. The 'find' command
brings up a dialog allowing the text to be searched for, replacement text,
and the variables 'forward', 'ignoreCase', 'regExpr', and 'matchWords' to
be set. Once these have been defined, the 'Search' menu contains several
commands for repeated searching, replacing, etc.
==============================================================================
==== Regular Expressions
==============================================================================
If the variable 'regExpr' is true, the search functions interpret the
search text as regular expressions, which have the following elements:
c literal char.
^ beginning of line.
$ end of line.
. any character except carriage return.
[...] character class, can use ranges such as '0-9'.
inside classes. Matches one character of the
enclosed choices. Ex: '[ac0-2]' matches 'a',
'c', '0', '1', or '2'.
[^...] negated character class, matches anything but
the enclosed characters. ']' can be included
by putting it immediately after the '^'.
\t tab.
\r carriage return or line break.
* zero or more occurrences of the previous
pattern. Ex: 'ab*' matches 'a', 'ab', 'abb',
'abbb' etc.
+ one or more occurrences of the previous
pattern.
? zero or one occurrences of the previous
pattern. Ex: 'ab?' matches 'a' or 'ab'.
a|b matches either a or b. If enclosed in
parenthesis, the extent of the alternated
expressions is limited. Ex: (pete|bob)
matches either 'pete' or 'bob'.
(...) The interior elements are grouped together.
Regular expressions constructed from the above elements can be
concatenated to create larger expressions.
The parenthesis also define substrings of the total matched string that
can be used either later during substitution. The substring delimited by
the pair of parenthesis that includes the nth left paren is denoted \n,
where n is 1, 2, .... 9. '\0' and '&' both refer to the matched text.
EXAMPLE:
The following regular expression will match either 'aabox' or 'bbbox':
(aa|bb)box
Regular expressions can be very difficult to master, but they the
following section shows how useful they can be.
==============================================================================
= Incremental Searches
==============================================================================
Emacs users will be happy that both forward and backward incremental
searches are implemented. Incremental searches bypass the normal search
dialog and search for the current text after each keystroke. The result is
often much faster and less intrusive. Executing either while an incremental
search is in progress causes the search to proceed to the next instance of
the current text. Incremental search mode is exited when any other command
(executed through the menus or through bindings that include at least one of
the control key and the option key) is executed, or when the escape or
delete key is used.
==============================================================================
= 'C' Tags
==============================================================================
ALPHA supports the use of tags to find declarations of functions. When
searching for a tag, ALPHA looks for the tag file specified by the
"tagFile" string variable. ALPHA's tag generating routines use the regular
expression in the string variable "funcExpr" to look for function
declarations. In other words, we don't parse the text. If you declare your
functions differently, you can change " funcExpr" to suit your own style.
Alpha currently uses the following regular expression to find C function
declarations:
^[^ \t#\r/@][^\r]*\([^\r]*\)$
(NOTE: the above expressions won't pick up many C++ method definitions. To
pick them up, add a question mark '?' after the last right parenthesis.)
Although complicated, this expression makes sense if you slowly wade
through it. The string that we are looking for must take up an entire
line. It must begin with a character other than '\t', '#', '\r', '/', ' ',
or '@'. There must be a set of parenthesis.
Note that not only can you customize this to your style of 'C'
declarations, you could also use it to generate tags for other languages.
The only thing you need to bear in mind is that the tag routines use the
complete word previous to the first '(' in the selected line as the
function's name. If there is no '(' in the selected line, the last word in
the line is used. Therefore, Pascal procedures w/ or w/o parameters can be
identified.
==============================================================================
= "Fill" Routines
==============================================================================
The "fill" and "wrap" routines reformat text to specified line lengths.
This is useful in two case. First, word processors such as Microsoft Word
only insert carriage returns at the end of paragraphs. Secondly, while
typing and inserting text into pre-existing paragraphs, the line lengths
become unequal.
The "wrap" routine handles word processor documents quickly by merely
inserting carriage returns as necessary to ensure all lines in the
selected region are shorter than specified by the variable 'fillColumn'.
Alpha asks the user if wrapping should be done whenever the user opens
files that have lines longer than 'paraColumn' characters.
The TCL routines 'fillRegion' and 'fillParagraph' go further. Not only do
they break lines, but they also coalesce lines to eliminate short lines.
Both routines work by stripping the relevent text of white space, then
re-inserting white space and carriage returns so that no line extends past
'fillColumn' characters in length and begins with 'leftFillColumn' spaces
characters. Both routines are implemented in the file 'procs.tcl', and
therefore different definitions of paragraphs can be accomodated by
modifing the appropriate TCL procedures.
==============================================================================
= Titlebar Menus
==============================================================================
If the value of the variable 'showMenuHeads' is non-zero, every text
window contains two boxes in the title bar. The first is by default
entitled "Func" and the second, "Mark". Depressing the mouse in these
boxes bring up popup menus.
The "Func" menu uses the regular expression defined by the string variable
'funcExpr' to create a popup menu containing a sorted list of all function
definitions in the current file. Using regular expressions this way is not
going to pick up all function definitions if your coding style is very
different than what Alpha expects. If this is the case, you may need to
play with the definition for 'funcExpr'.
Selecting an item from this menu immediately displays the definition of
that function. If the 'shift' key is depressed when the menu is created,
the methods menu is not sorted. The 'sortedIsDefault' var reverses these
semantics.
The "Mark" menu displays a list of all permanent marks in the current
file. Selecting an item from the menu causes the insertion to be placed at
the corresponding mark.
The behavior of the function menu can be changed dramatically by the user.
The method-func routine uses 'funcExpr' to locate a line containing a C
definition, and then another routine extracts the function name.
If the variable 'funcTitle' is set to "Func", the label of the menu is
"Func" and for each match found, a menu item is created with the text of
the last word before the first left parenthesis in the match. For example,
if the following is matched text:
this is matched text (one (silly))
the word 'text' would be inserted into the popup menu as an item.
If 'funcTitle' is not set to "Func", then the two things happen. First, the
contents of 'funcTitle' are used as the label for the func popup box.
Second, Alpha adds a menu item constructed from the text inside the
'funcPar'th parenthesized expression in the match, where 'funcPar' is an
Alpha variable of the same name. Note that the parenthesis in this case are
part of the regular expression, the actual text may not have parenthesis at
all, and probably doesn't. For more information on this, look at the manual
page for regular expressions (in the "Help" menu).
See the startup files for examples of both methods.
==============================================================================
= Defining and Using File Sets
==============================================================================
File Sets are lists of files that Alpha uses for multiple-file searches and
tag searches, among other things. Typically, a user will set up several
different file sets in the AlphaBits.tcl file, perhaps one specifying all
the source files in a project, another specifying all the Mac include
files, and another specifying all the UNIX include files. When a command
using file sets is initiated, Alpha evaluates the command"getCurrFileSet",
which returns a list of complete pathnames to search. Some of the lists are
set up explicitly (see the 'noGlobNecessary' definition in "procs.tcl"),
while other file sets are defined at startup time through the use of file
globbing. See the TCL manual page for a definition of "glob"ing. The
definition of the variable "globNecessary" in "procs.tcl" shows how to to
this.
Functions that use file sets operate on the "current" fileset, which is
specified by the 'fileSet' variable. The current file set can also be
switched by using the "File Set" heirarchical menu.
5.02 includes a new Tcl proc 'addFileset', which allows a fileset to be
created on the fly (Unfortunately, there is currently a bug in the handling
of this routine that eventually crashes the system, use with care). This
fileset remains usable until Alpha is restarted. It should be quite simple
to use Tcl to make this new fileset permanent. A Tcl proc could also be
written to create a heirarchical menus that has a submenu for each fileset,
the items of each submenu being the files for that fileset. However, I'm
not going to write everything...
=============================================================================
= Keyboard Macros
=============================================================================
Defining and Using Keyboard Macros
ALPHA supports keyboard macros which record a sequence of keystrokes to be
played back later w/ the function 'executeKeyboardMacro' (this function is
also in the 'Utilities' menu) or written into a buffer by selecting 'Dump
Function' from the 'Utilities' menu. The dump function prompts you for a
macro name, which must consist only of letters of the alphabet, digits,
and '_'.
These macro declarations can then be edited, loaded, and bound to
keystrokes. Loading a macro or a binding is accomplished by hiliting the
text and selecting the "Load Selection" item of the 'Customize' window. If
no text is hilited, the entire window is loaded by the same command.
Macros can be bound to keys in exactly the same manner as functions (see
above).
=============================================================================
= Undo + Redo
=============================================================================
ALPHA supports unlimited undo and redo. This means that most changes can
be undone, and then redone, at will. Bear in mind that once you create new
modifications, all changes that you have undone but not redone are lost.
Another point to bear in mind is that saving a buffer to disk currently
flushes the undo buffer.
=============================================================================
= Using Think C
=============================================================================
Closed environments like Think present problems to the developer using
other tools. However, the following tips should help:
• After editing with Alpha, hit the 'Use Disk' button from the 'Build'
menu item to force Think to check modification times for a build.
• Move all your project source files into a single directory. Then insert
a new entry into the 'noGlobNecessary' section of file "procs.tcl" w/
file pattern *.c.
=============================================================================
= Rectangular Editing
=============================================================================
If the option key is pressed while the mouse is dragged, a rectangular
section of text is selected instead of the normal selection. This
rectangular selection may extend over multiple lines, but contains only
text between the column of the drag start and the column of the drag end.
The drag cannot end on a column or row less than the start. This selection
can be extended by option-shift-mouse, but not dragged further.
The rectangular selection can be deleted, copied, and pasted. This is very
useful for tables and arrays, such as in LaTeX. Usually, the operation
will be intuitive. However, if you use proportional fonts the selection
may appear ragged. If some of the line contain tabs, the result may not be
want you want. Converting tabs to spaces in the desired region before
attempting rectangular selection usually fixes the problems.
The most natural semantics of rectangular selection aren't obvious. I
chose to implement it in a similar fashion to that of Microsoft Word.
Preditor does it in another way, and has many bugs (and it's commercial,
hah!).
=============================================================================
= Using LaTeX
=============================================================================
As I am starting to write papers on my Mac using OzTeX, Alpha may migrate
increasingly into the realm of LaTeX users. For starters, LaTeX support
includes:
• automatic word-wrapping.
• fill paragraph and fill region commands.
• support for changing paragraph definitions
so that a backslash limits paragraph extent.
• rectangular editing mode, useful for working
with tables and arrays.
• title-bar section menu.
• suffix hook for .tex (see the section on suffix
hooks) that can automatically enable all this.
The only one of the above items that hasn't been explained is the
title-bar section menu, which is specified by appropriate settings of
'funcExpr', funcTitle', and 'funcPar'. For files ending in ".tex", the
title-bar contains a box labeled "Sect". Clicking on this box creates a
popup menu containg all section definitions in the current file. Selecting
one puts the cursor at the beginning of the section. See the Popup Menus
section and the startup files for more information.
In addition, distributions from 4.01 on include a folder of
user-contributed TeX/LaTeX macros.
=============================================================================
= Variables
=============================================================================
Alpha supports two different kinds of variables. The following "Alpha
variables" are available under the "Utils" menu and are set and queried
using the tcl functions 'setVar' and 'getVar'. The second kind of
variable, not enumerate below, are simple Tcl variables. Tcl variables
are set using the Tcl command 'set', and queried using the $var syntax.
Tcl variable values are not available through any menus.
autoSave • If TRUE, buffers (except untitled buffers) are automatically
saved every 'changesLim' changes.
backExtension • suffix to add to file name to create
name of backup file. Initially ".BAK".
backup • if TRUE, Alpha makes a backup of
every file before writing new data.
backupFolder • if 'backupFolder' is true and the folder named by
'backupFolderName' is on the same volume as the original, the
backup file is created in the 'backupFolderName' folder.
backupFolderName • name of folder to place backups.
bwWindows • if true, Alpha will use 1-bit windows
even if color is available. This speeds
refresh quite a bit on slow color
machines such as the IIsi.
changesLim • number of changes to a window before
garbage collection or autosave is done.
currFileSet • name of currently selected file set.
defaultFont • font to use on new windows and files
which don't have associated font
specification resources.
defHeight • If 'fullScreen' set, this is default
height in pixels.
defWidth • If 'fullScreen' set, this is default
width in pixels.
elecLBrace • Electric 'C' left brace on.
elecRBrace • Electric 'C' right brace on.
electricSemi • Electric 'C' semicolon on.
fillColumn • Number of columns use as limit for
"fill" routines. See 'leftFillColumn'
fontSaving • if '-1', Alpha never saves font info,
if '1', Alpha always saves font info,
'0', Alpha saves font info if the font
or size is different than the default.
fontSize • Default size of fonts used to display
files.
forward • set when searching forward. The
'findFile' dialog always resets this
before displaying.
fullNames • Windows display pathnames instead of
mere file names.
fullScreen • If on, all windows are start in the
same place, and have the dimension
specified by 'defHeight' and
'defWidth'.
funcPar • Used in defining the "Func" title-bar menu, see Alpha
help.
funcExpr • Set to the regular expression that
ALPHA uses to find function
declarations.
funcTitle • Text to put in title-bar menu header.
See the Popup-Menus section for more
information.
ignoreCase • Search is case-insensitive.
includePath • A list of the path-names of the
directories to search for include
files, separated by semi-colons, such
as:
"Disk:C:edit;Disk:C:THINK C:include;"
The current directory can be included
by using consecutive semi-colons as:
"Disk:C:edit;Disk:C:THINK C:inc;;"
indentOnCR • Auto-indent on carriage return.
leftFillColumn • Number of blanks left at beginning of
lines by 'fill' routines.
matchWords • Match words on searches.
moveInsertion • if true, 'pageBack' and 'pageForward'
move the insertion point
noRemapOption • When set, does not overlay system
resource w/ one that does not have
"dead keys". If TRUE, some option
sequences are not usable. Owners of
foreign keyboard will want this turned
on. Default: TRUE.
numWinsToTile • specifies the number of windows tile
commands should affect.
openAllFIles • if true, or it option key down, files
of all types are openable, not just
'TEXT'.
optionIsMeta • If set, the key combination with escape
is used instead of the option key
combination. Note that some
combinations with option chars are
dead keys.
paraColumn • Alpha automatically wraps files
that contains lines longer than this.
posActivate • If true, then merely moving the mouse
over a window activates. For those
X11-twm lovers.
powerThumb • If true, vertical scrollbars have power thumbs.
protoFile • name of file to dump prototypes into.
regExpr • flag set if searchAgain should look
for a regular expression
savedState • set to either "mpw", "think", or "none" depending on what
you wish the default behavior to be in terms of what goes into
the resource fork of the applications you modify. See the "Files"
section of this file for more information.
showRowCol • if set, row and col are continuously
displayed in the title bar.
showMenuHeads • If set, the function and mark menus can
be selected from the title bar.
sortColumn • column to use for sort routine.
sortedIsDefault• if set, sorted is the default for
function and section menus.
startWithNew • When one, ALPHA comes up w/ new
buffer. When 0, ALPHA comes up w/
a prompt for a file. When 2, ALPHA
comes up w/ nothing.
suppressHeader • Suppress header on printed pages.
tabSize • Default number of characters per tab.
tagFile • complete path-name of tag file
tempMem • if zero, Alpha will not use temporary
memory.
undoOn • used to turn undo on and off. When undo
is turned off, all undo info is lost.
Useful when doing global replaces, etc.
useTempMem • toggles whether Alpha will use
temporary memory with System 7.0.
undonOn • If true, undo information kept.
wordWrap • if true, lines exceeding 'fillColumn'
in length are automatically wrapped
during normal text insertion (typing)
=============================================================================
= The (Dreaded) Option Key
=============================================================================
ALPHA's default setup uses the command key like any other mac application.
Problems arise in ALPHA's emulation of emacs key bindings. Emacs uses an
escape key and a control key. Alpha's default configuration is set up for
Mac II's. Emacs's escape and control keys are emulated by the Mac's
corresponding keys. For Mac+'s, however, the situation is much more
complicated. They don't have an escape key, so the the backquote key, '`',
must be used instead. This can be set up by uncommenting the appropriate
line in the "AlphaBits.tcl" file. Also, Mac+'s don't have control keys, so
the option key can be used instead. However....
Using the option key isn't quite that simple. First, the option key is
already used in two contexts. There may be other option bindings. Also, if
the variable 'optionIsEscape' is set, the option key is treated as if it
is an escape so as to allow single keystroke calls of Alpha functions. In
order to use the option key as an escape key, this variable must be set to
zero in the AlphaBits file. Also, all the relevant bindings must have
their modifier strings changed from using 'z' to 'o'.
There are other problems. Several option combinations are "dead keys"
(option-e, option-o....), they are used to create bizarre (sorry to y'all
non-Amuricans) characters through multiple keystrokes. Alpha can fix this
by overlaying the system 'KCHR' resource with a private modified resource.
This happens at startup time if the "AlphaBits.tcl" file specifies a zero
value for the variable 'noRemapOption'. Unfortunately, this is just a US
version of the resource, it won't work "fur the non-Amuricans".
=============================================================================
= System Software 7.0 and Alpha
=============================================================================
Alpha is 32-bit clean and high-level event aware. However, Alpha currently
only supports only the four "required" high-level events: OpenApp,
OpenDoc, PrintDoc, and QuitApp. If I ever get hold of this mythical Apple
Events Registry I intend to support other events, such as those having to
do with spell checking, for example.
In addition, there is always the (faint) possibility that Symantec will
open up their system to third-party editors. If so, I'll accommodate their
events as soon as they publish them. I am unable to work with MPW as I
don't own it, but my understanding is that they do not yet supports
"error" apple events, as I hope they eventually will.
Under 7.0, Alpha uses temporary memory to accommodate large files. This
allows you to open multi-megabyte files even when Alpha's partition is set
only at 512k, if the system has that much memory available. Note that
using temporary memory makes that much memory unavailable to other
applications. Contrary to all admonishments, Alpha does not unlock
temporary memory across WaitNextEvent calls and may eventually use all the
memory in your system. You can turn this feature off through 'useTempMem'.
Note, however, that the clipboard is allocated by the system in Alpha's
heap, and therefore cannot take advantage of temporary memory.
Alpha 3.6 has new color icons. You may need to rebuild your desktop in
order to see them.
=============================================================================
= File Formats
=============================================================================
Alpha reads and writes files stored in three (or maybe four) different
formats. The three main formats are mac (lines end with a carriage
return), unix (lines end with linefeed), and IBM pc (lines end with both
carriage return and linefeed. Typical, isn't it?).
Alpha will transparently read and write all three of these formats. You
don't have to do anything special to use different formats, but the
'SaveAs...' dialog allows you to specify the format that a file is written
in through the 'Format' button.
The fourth file format is just a modification of the ordinary mac format.
Word processors such as Microsoft Word and MacWrite only put carriage
returns at the end of paragraphs, so that they can wrap the paragraphs on
the fly. This is what is referred to as 'paragraph format' in the rest of
the help text. Alpha does not transparently convert to and from this
format because there are valid reasons why someone might want to edit a
paragraph formatted file while not in paragraph mode.
Therefore, when Alpha detects reads a paragraph-mode file, it asks the
user whether or not to remap it. Files can be mapped back to paragraph
mode by setting 'fillColumn' to a very large number and executing
'fillRegion' on the text.
=============================================================================
= Tips and other Miscellaneous Diversions...
=============================================================================
• When a window is "dirty" (has unsaved changes), a
diamond appears in the title bar and next to the
corresponding item in the Windows menu.
• All dialogs that have editable text can use the Cut,
Copy, and Paste menu command equivalents.
• In all dialogs, non-editable controls can be selected
by typing Command-<first char of control>. If there
are no editable controls in the dialog, simply typing
the first letter of the desired control suffices.
• Dirty windows are marked with a diamond in the
window's title bar. The corresponding menu items in
the 'Window' menu will also have a diamond mark next
to it.
• Set the flag 'undoOn' to 0 in order to speed up long
replace-all and macro modifications.
• After a piece of text has been yank'd or paste'd, the
'mark' is set to the beginning of the new text and the
selection is at the end. 'markHilite' will now hilite
the entire insertion. This is especially useful when
moving code. Cut the code, insert at a new position,
select the inserted text by selecting "Edit:Hilite", and
then use "Edit:Shift Left" and "Edit: Shift Right" to move
the text to the proper indentation.